﻿using PMS.Core.Configuration.CommonEnumConfigs;
using System.Collections.Generic;
using System.Linq;

namespace PMS.Data.Entities.NaviMenus
{
    /// <summary>
    /// Represents a NaviMenuTemplate record
    /// </summary>
    public partial class NaviMenuLayoutTemplate : BaseEntity
    {
        /// <summary>
        /// Gets or sets the Layout TemplateName  
        /// </summary>
        public string TemplateName { get; set; }

        /// <summary>
        /// Gets or sets the Layout Template Description
        /// </summary>
        public string TemplateDescription { get; set; }

        /// <summary>
        /// Gets or sets the LayoutTemplateType
        /// </summary>
        public LayoutTemplateType TemplateType { get; set; }

        /// <summary>
        /// 模板页路径，配合.netcore mvc存储模板页ViewName所指定的模板页，
        /// 此方法适用于有SEO要求的页面在服务器端完成页面渲染输出
        /// </summary>
        public string ViewPath { get; set; }

        /// <summary>
        /// 默认列表页展示数据数
        /// 当NaviMenu页未设置列表页PageSize时，使用此默认值
        /// </summary>
        public int PageSize { get; set; }

        /// <summary>
        /// 默认列表页可选展示数 
        /// 当NaviMenu页未设置列表页PageSizeOptions时，使用此默认值
        /// </summary>
        public string PageSizeOptions { get; set; }

        /// <summary>
        /// PageSizeOptions的数据转化
        /// </summary>
        public List<int> PageSizeOptionList
        {
            get
            {
                return PageSizeOptions.Split(',').Select(int.Parse).ToList();
            }
            set
            {
                PageSizeOptions = value == null || value.Count == 0
                                ? "10,15,20,30,50,100"
                                : string.Join(',', value);
            }
        }

        /// <summary>
        /// Gets or sets the order of the MenuTemplate
        /// </summary>
        public int DisplayOrder { get; set; }

        /// <summary>
        /// related to MediaFile to represent the LayoutTemplate preview Style
        /// </summary>
        public int TemplatePreviewImageId { get; set; }
        //Set IsActive Mapped On BaseEntity
        //public bool IsActive { get; set; }
        //public DateTime CreatedOnTimeUtc { get; set; }
        //Set UpdatedOnTimeUtc NotMapped
        //public DateTime UpdatedOnTimeUtc { get; set; }
    }
}
